#include <iostream>
#include <cstring>
#include <ctime>
#include <cassert>
#include <unistd.h>
#include <fcntl.h>
#include <netinet/in.h>
#include <arpa/inet.h>
#include <sys/epoll.h>
#include <sys/types.h>
#include <sys/socket.h>

using namespace std;

int main()
{
    int sock = socket(AF_INET, SOCK_STREAM, 0);
    sockaddr_in local;

    local.sin_family = AF_INET;
    local.sin_port = htons(8082);
    local.sin_addr.s_addr = inet_addr("127.0.0.1");

    int ret = connect(sock, (sockaddr*)(&local), sizeof(local));
    if(ret == 0)
    {
        cout << "connect successfully, fd is " << sock << endl;
    }
    
    while(1)
    {
        string info;
        cin >> info;
        send(sock, info.c_str(), info.size(),0);

        //char buffer[1024];

    }
    close(sock);

    return 0;
}
